/*----------------------------------------------------------------------------
 * osObjects.h: CMSIS-RTOS global object definitions for an application
 *----------------------------------------------------------------------------
 *
 * This header file defines global RTOS objects used throughout a project
 *
 * #define osObjectsPublic indicates that objects are defined; without that
 * definition the objects are defined as external symbols.
 *
 *--------------------------------------------------------------------------*/


#ifndef __osObjects
#define __osObjects

#ifdef osObjectsPublic
#define OBJ_EXT  
#else
#define OBJ_EXT extern 
#endif

#include  <includes.h>            
#include "stm32f4xx_hal.h"

void  AppTaskCreate (void);
void  AppObjCreate (void);

// global 'thread' functions ---------------------------------------------------

#define  TASK_LEDCTR_STK_SIZE                    0x100
#define  TASK_LEDCTR_PRIO                        3
OBJ_EXT  OS_TCB         LedCtrTaskTCB;
OBJ_EXT  CPU_STK        LedCtrTaskStk[TASK_LEDCTR_STK_SIZE];
OBJ_EXT  void           LedCtrTask               (void  *p_arg);

#define  TASK_LCDCTR_STK_SIZE                    0x400
#define  TASK_LCDCTR_PRIO                        16
OBJ_EXT  OS_TCB         LcdCtrTaskTCB;
OBJ_EXT  CPU_STK        LcdCtrTaskStk[TASK_LCDCTR_STK_SIZE];
OBJ_EXT  void           LcdCtrTask               (void  *p_arg);

#define  TASK_COM_STK_SIZE                       0x100
#define  TASK_COM_PRIO                           10
OBJ_EXT  OS_TCB         ComTaskTCB;
OBJ_EXT  CPU_STK        ComTaskStk[TASK_COM_STK_SIZE];
OBJ_EXT  void           ComTask                  (void  *p_arg);

#define  TASK_STORAGE_STK_SIZE                    0x1000
#define  TASK_STORAGE_PRIO                        18
OBJ_EXT  OS_TCB         StorageTaskTCB;
OBJ_EXT  CPU_STK        StorageTaskStk[TASK_STORAGE_STK_SIZE];
OBJ_EXT  void           StorageTask               (void  *p_arg);

#define  TASK_TEST_STK_SIZE                      0x100
#define  TASK_TEST_PRIO                          17
OBJ_EXT  OS_TCB         TestTaskTCB;
OBJ_EXT  CPU_STK        TestTaskStk[TASK_TEST_STK_SIZE];
OBJ_EXT  void           TestTask               (void  *p_arg);

#define  TASK_SYS_STK_SIZE                      0x100
#define  TASK_SYS_PRIO                          5
OBJ_EXT  OS_TCB         SysTaskTCB;
OBJ_EXT  CPU_STK        SysTaskStk[TASK_SYS_STK_SIZE];
OBJ_EXT  void           SysTask               (void  *p_arg);

#define  TASK_MODBUS_STK_SIZE                    0x100
#define  TASK_MODBUS_PRIO                        8
OBJ_EXT  OS_TCB         ModbusTaskTCB;
OBJ_EXT  CPU_STK        ModbusTaskStk[TASK_MODBUS_STK_SIZE];
OBJ_EXT  void           ModbusTask               (void  *p_arg);

#define TOUCH_TASK_PRIO				4
#define TOUCH_STK_SIZE				0x100
OBJ_EXT OS_TCB TouchTaskTCB;
OBJ_EXT CPU_STK TOUCH_TASK_STK[TOUCH_STK_SIZE];
OBJ_EXT void touch_task(void *p_arg);

// global enent-groups object  -------------------------------------------------



// global mutex object     -----------------------------------------------------
OBJ_EXT OS_MUTEX      MutexObjI2C;
OBJ_EXT OS_MUTEX      MutexObjLcd;
OBJ_EXT OS_MUTEX      MutexObjMemMan;

// global message queue object     ---------------------------------------------
#define                 LCD_QUENE_MSG_SIZE      ((OS_MSG_QTY)8)
OBJ_EXT OS_Q            LcdQueue;

// global  event object     ---------------------------------------------
OBJ_EXT OS_FLAG_GRP     FlagModbusEvent;

#endif  // __osObjects
